//#pragma execution_character_set("utf-8")
#include "ProgressDlg.h"
#include <QFont>
#include <QLabel>
#include <QLineEdit>
#include <QComboBox>
#include <QProgressBar>
#include <QPushButton>
#include <QGridLayout>
#include <QProgressDialog>

ProgressDlg::ProgressDlg(QWidget* parent)
  : QDialog(parent)
{
  QFont font("Times New Roman", 12, QFont::Bold);
  setWindowTitle(QString::fromLocal8Bit("进度"));
  // 设置窗口大小
  resize(200, 60);
  ProgressMessage = new QLabel;
  ProgressMessage->setFont(font);
  ProgressMessage->setText(tr(" "));
  progressBar = new QProgressBar;
  mainLayout = new QGridLayout(this);
  mainLayout->addWidget(ProgressMessage, 1, 0);
  progressBar->setRange(0, 100);
  mainLayout->addWidget(progressBar, 2, 0, 1, 2);
}

ProgressDlg::~ProgressDlg()
{
  if (ProgressMessage) delete ProgressMessage;
  if (progressBar) delete progressBar;
  if (mainLayout) delete mainLayout;
}

void ProgressDlg::ShowMessageState(QString msg, int state, float per)
{
  progressBar->setValue(per);
  ProgressMessage->setText(msg);

}

void ProgressDlg::startProgress()
{

}